package com.zhu.blog.dao;

import com.zhu.blog.model.GitHub;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface GithubRepository extends JpaRepository<GitHub,Long> {

    @Query("select g from GitHub g where g.nodeId = ?1")
    GitHub findGitHubUser(String nodeId);

    @Transactional
    @Modifying
    @Query("update GitHub g set g.cip = ?1,g.cid = ?2,g.cname = ?3,g.nodeId = ?4")
    void addIpAddress(String cip,String cid,String cname,String node_id);
}
